package com.kitty.game.bag.service.giftHandler;


import com.kitty.common.utils.SpringUtils;

import java.util.HashMap;
import java.util.Map;

public enum GiftHelper {
    INSTANCE;

    private static final Map<String, GiftHandler> handlers = new HashMap<>();

    public void init(String giftType, GiftHandler giftHandler) {
        handlers.put(giftType, giftHandler);
    }

    public GiftHandler getGiftHelper(String giftType) {
        return handlers.get(giftType);
    }

    public Map<String, GiftHandler> getHandlers() {
        return handlers;
    }

    static {
        INSTANCE.init("装备", SpringUtils.getBean(EquipGiftHandler.class));
        INSTANCE.init("宠物", SpringUtils.getBean(EquipGiftHandler.class));

        INSTANCE.init("魂窍", SpringUtils.getBean(HunQiaoGiftHandler.class));
        INSTANCE.init("首饰", SpringUtils.getBean(JewelryGiftHandler.class));
    }
}
